static
arglist_t arcdist_args[] = {
{"file", &arcfileopt, "File containing vertices of arc",
- ARGTYPE_FILE | ARGTYPE_REQUIRED},
+ NULL, ARGTYPE_FILE | ARGTYPE_REQUIRED},
{"distance", &distopt, "Maximum distance from arc",
- ARGTYPE_FLOAT | ARGTYPE_REQUIRED},
- {"exclude", &exclopt, "Exclude points close to the arc", ARGTYPE_BOOL},
- {"points", &ptsopt, "Use distance from vertices not lines",
+ NULL, ARGTYPE_FLOAT | ARGTYPE_REQUIRED},
+ {"exclude", &exclopt, "Exclude points close to the arc", NULL,
ARGTYPE_BOOL},
- {0, 0, 0, 0}
+ {"points", &ptsopt, "Use distance from vertices not lines",
+ NULL, ARGTYPE_BOOL},
+ {0, 0, 0, 0, 0}
};
#define BADVAL 999999
}
static arglist_t brauniger_iq_args[] = {
- {0, 0, 0, 0}
+ {0, 0, 0, 0, 0}
};
ff_vecs_t brauniger_iq_vecs = {
NULL,
data_read,
NULL,
+ NULL,
brauniger_iq_args
};
static
arglist_t cetus_args[] = {
- {"dbname", &dbname, "Database name", ARGTYPE_STRING },
+ {"dbname", &dbname, "Database name", NULL, ARGTYPE_STRING },
{"appendicon", &appendicon, "Append icon_descr to description.",
- ARGTYPE_BOOL },
+ NULL, ARGTYPE_BOOL },
{0, 0, 0, 0 }
};
wr_deinit,
data_read,
data_write,
+ NULL,
cetus_args,
};
typedef void (*ff_deinit) (void);
typedef void (*ff_read) (void);
typedef void (*ff_write) (void);
+typedef void (*ff_exit) (void);
#ifndef DEBUG_MEM
char * get_option(const char *iarglist, const char *argname);
char *argstring;
char **argval;
char *helpstring;
+ char *defaultvalue;
long argtype;
} arglist_t;
ff_deinit wr_deinit;
ff_read read;
ff_write write;
+ ff_exit exit;
arglist_t *args;
} ff_vecs_t;
static
arglist_t dup_args[] = {
{"shortname", &snopt, "Suppress duplicate waypoints based on name",
- ARGTYPE_BOOL},
+ NULL, ARGTYPE_BOOL},
{"location", &lcopt, "Suppress duplicate waypoint based on coords",
- ARGTYPE_BOOL},
+ NULL, ARGTYPE_BOOL},
{"all", &purge_duplicates, "Suppress all instances of duplicates",
- ARGTYPE_BOOL},
+ NULL, ARGTYPE_BOOL},
{"correct", &correct_coords, "Use coords from duplicate points",
- ARGTYPE_BOOL},
- {0, 0, 0, 0}
+ NULL, ARGTYPE_BOOL},
+ {0, 0, 0, 0, 0}
};
static FILE *file_in;
static FILE *file_out;
static void *mkshort_handle;
-static char *deficon = "Waypoint";
+static char *deficon = NULL;
#define MYNAME "EasyGPS"
static
arglist_t easygps_args[] = {
-/* {"deficon", &deficon, "Default icon name", ARGTYPE_STRING}, */
+/* {"deficon", &deficon, "Default icon name", "Waypoint",
+ ARGTYPE_STRING}, */
{0, 0, 0, 0 }
};
wr_deinit,
data_read,
data_write,
+ NULL,
easygps_args
};
if (vec->vec->args) {
for (ap = vec->vec->args; ap->argstring; ap++){
- *ap->argval = get_option(*opts, ap->argstring);
+ char *opt = get_option(*opts,
+ ap->argstring);
+ if ( opts ) {
+ *ap->argval = opt;
+ }
+ else if ( ap->defaultvalue ) {
+ *ap->argval = xstrdup(
+ ap->defaultvalue);
+ }
+ else {
+ *ap->argval = NULL;
+ }
}
}
} else {
*opts = NULL;
+ if (vec->vec->args) {
+ for (ap = vec->vec->args; ap->argstring; ap++){
+ if ( ap->defaultvalue ) {
+ *ap->argval = xstrdup(
+ ap->defaultvalue);
+ }
+ else {
+ *ap->argval = NULL;
+ }
+ }
+ }
}
xfree(v);
static GPS_PWay *cur_tx_routelist_entry;
static GPS_PTrack *tx_tracklist;
static GPS_PTrack *cur_tx_tracklist_entry;
-static char *getposn;
-static char *poweroff;
-static char *snlen;
-static char *snwhiteopt;
+static char *getposn = NULL;
+static char *poweroff = NULL;
+static char *snlen = NULL;
+static char *snwhiteopt = NULL;
static
arglist_t garmin_args[] = {
- { "snlen", &snlen, "Length of generated shortnames", ARGTYPE_INT },
+ { "snlen", &snlen, "Length of generated shortnames", NULL,
+ ARGTYPE_INT },
{ "snwhite", &snwhiteopt, "(0/1) Allow whitespace synth. shortnames",
- ARGTYPE_BOOL},
+ NULL, ARGTYPE_BOOL},
{ "get_posn", &getposn, "Return current position as a waypoint",
- ARGTYPE_BOOL},
+ NULL, ARGTYPE_BOOL},
{ "power_off", &poweroff, "Command unit to power itself down",
- ARGTYPE_BOOL},
+ NULL, ARGTYPE_BOOL},
{ 0, 0, 0, 0}
};
rw_deinit,
data_read,
data_write,
+ NULL,
garmin_args
};
static int in_cdata;
static char *cdatastr;
static char *typestr;
-static char *deficon;
+static char *deficon = NULL;
static waypoint *wpt_tmp;
static
arglist_t geo_args[] = {
- {"deficon", &deficon, "Default icon name", ARGTYPE_STRING },
- {0, 0, 0, 0}
+ {"deficon", &deficon, "Default icon name", NULL, ARGTYPE_STRING },
+ {0, 0, 0, 0, 0}
};
#define MYNAME "geo"
geo_wr_deinit,
geo_read,
geo_write,
+ NULL,
geo_args
};
static
arglist_t Args[] = {
{"dbname", &Arg_dbname,
- "Database name (filename)", ARGTYPE_STRING },
+ "Database name (filename)", NULL, ARGTYPE_STRING },
{"category", &Arg_category,
- "Category name (Cache)", ARGTYPE_STRING },
+ "Category name (Cache)", NULL, ARGTYPE_STRING },
{0, 0, 0, 0 }
};
wr_deinit,
data_read,
data_write,
+ NULL,
Args
};
static
arglist_t my_args[] = {
- {"dbname", &dbname, "Database name", ARGTYPE_STRING},
- {0, 0, 0, 0}
+ {"dbname", &dbname, "Database name", NULL, ARGTYPE_STRING},
+ {0, 0, 0, 0, 0}
};
static void
wr_deinit,
data_read,
data_write,
+ NULL,
my_args
};
static
arglist_t gpspilot_args[] = {
- {"dbname", &dbname, "Database name", ARGTYPE_STRING},
- {0, 0, 0, 0}
+ {"dbname", &dbname, "Database name", NULL, ARGTYPE_STRING},
+ {0, 0, 0, 0, 0}
};
static void
wr_deinit,
data_read,
data_write,
+ NULL,
gpspilot_args
};
arglist_t gpx_args[] = {
{ "gsshortnames", &gsshortnames,
"Prefer shorter descriptions from Groundspeak files",
- ARGTYPE_BOOL },
- { "snlen", &snlen, "Length of generated shortnames", ARGTYPE_INT },
+ NULL, ARGTYPE_BOOL },
+ { "snlen", &snlen, "Length of generated shortnames",
+ NULL, ARGTYPE_INT },
{ "suppresswhite", &suppresswhite,
- "Suppress whitespace in generated shortnames", ARGTYPE_BOOL },
- { "logpoint", &opt_logpoint, "Create waypoints from geocache log entries", ARGTYPE_BOOL },
- { "urlbase", &urlbase, "Base URL for link tag in output", ARGTYPE_STRING},
- { 0, 0, 0, 0 }
+ "Suppress whitespace in generated shortnames",
+ NULL, ARGTYPE_BOOL },
+ { "logpoint", &opt_logpoint,
+ "Create waypoints from geocache log entries",
+ NULL, ARGTYPE_BOOL },
+ { "urlbase", &urlbase, "Base URL for link tag in output",
+ NULL, ARGTYPE_STRING},
+ { 0, 0, 0, 0, 0 }
};
ff_vecs_t gpx_vecs = {
gpx_wr_deinit,
gpx_read,
gpx_write,
+ NULL,
gpx_args,
};
static
arglist_t hsa_ndv_args[] = {
-// {"deficon", &deficon, "Default icon name", ARGTYPE_STRING },
- {0, 0, 0, 0}
+ {0, 0, 0, 0, 0}
};
#define MYNAME "HsaNdv"
hsa_ndv_wr_deinit,
hsa_ndv_read,
hsa_ndv_write,
+ NULL,
hsa_ndv_args
};
static
arglist_t html_args[] = {
{ "stylesheet", &stylesheet,
- "Path to HTML style sheet", ARGTYPE_STRING },
+ "Path to HTML style sheet", NULL, ARGTYPE_STRING },
{ "encrypt", &encrypt,
- "Encrypt hints using ROT13", ARGTYPE_BOOL },
+ "Encrypt hints using ROT13", NULL, ARGTYPE_BOOL },
{ "logs", &includelogs,
- "Include groundspeak logs if present", ARGTYPE_BOOL },
- {0, 0, 0, 0}
+ "Include groundspeak logs if present", NULL, ARGTYPE_BOOL },
+ {0, 0, 0, 0, 0}
};
wr_deinit,
NULL,
data_write,
+ NULL,
html_args
};
static arglist_t igc_args[] = {
{"timeadj", &timeadj,
- "(integer sec or 'auto') Barograph to GPS time diff", ARGTYPE_STRING},
- {0, 0, 0, 0}
+ "(integer sec or 'auto') Barograph to GPS time diff",
+ NULL, ARGTYPE_STRING},
+ {0, 0, 0, 0, 0}
};
ff_vecs_t igc_vecs = {
wr_deinit,
data_read,
data_write,
+ NULL,
igc_args
};
*/
static
arglist_t mag_sargs[] = {
- {"baud", &bs, "Numeric value of bitrate (baud=4800)", ARGTYPE_INT },
+ {"baud", &bs, "Numeric value of bitrate (baud=4800)", NULL,
+ ARGTYPE_INT },
{"noack", &noack, "Suppress use of handshaking in name of speed",
- ARGTYPE_BOOL},
- {"deficon", &deficon, "Default icon name", ARGTYPE_STRING },
- {"nukewpt", &nukewpt, "Delete all waypoints", ARGTYPE_BOOL },
- {0, 0, 0, 0}
+ NULL, ARGTYPE_BOOL},
+ {"deficon", &deficon, "Default icon name", NULL, ARGTYPE_STRING },
+ {"nukewpt", &nukewpt, "Delete all waypoints", NULL, ARGTYPE_BOOL },
+ {0, 0, 0, 0, 0}
};
static
arglist_t mag_fargs[] = {
- {"deficon", &deficon, "Default icon name", ARGTYPE_STRING },
- {0, 0, 0, 0}
+ {"deficon", &deficon, "Default icon name", NULL, ARGTYPE_STRING },
+ {0, 0, 0, 0, 0}
};
static void
mag_deinit,
mag_read,
mag_write,
+ NULL,
mag_sargs
};
mag_deinit,
mag_read,
mag_write,
+ NULL,
mag_fargs
};
#define MPSNOTESBUFFERLEN 4096
#define MPSDESCBUFFERLEN 4096
-char *snlen;
-char *snwhiteopt;
-char *mpsverout;
+char *snlen = NULL;
+char *snwhiteopt = NULL;
+char *mpsverout = NULL;
char *mpsmergeout = NULL;
char *mpsusedepth = NULL;
char *mpsuseprox = NULL;
static
arglist_t mps_args[] = {
- {"snlen", &snlen, "Length of generated shortnames", ARGTYPE_INT },
+ {"snlen", &snlen, "Length of generated shortnames", NULL, ARGTYPE_INT },
{ "snwhite", &snwhiteopt, "(0/1) Allow whitespace synth. shortnames",
- ARGTYPE_BOOL},
- {"mpsverout", &mpsverout, "Version of mapsource file to generate (3,4,5)", ARGTYPE_INT },
- {"mpsmergeout", &mpsmergeout, "Merge output with existing file", ARGTYPE_BOOL },
- {"mpsusedepth", &mpsusedepth, "Use depth values on output (default is ignore)", ARGTYPE_BOOL },
- {"mpsuseprox", &mpsuseprox, "Use proximity values on output (default is ignore)", ARGTYPE_BOOL },
- {0, 0, 0, 0}
+ NULL, ARGTYPE_BOOL},
+ {"mpsverout", &mpsverout,
+ "Version of mapsource file to generate (3,4,5)", NULL,
+ ARGTYPE_INT },
+ {"mpsmergeout", &mpsmergeout, "Merge output with existing file",
+ NULL, ARGTYPE_BOOL },
+ {"mpsusedepth", &mpsusedepth,
+ "Use depth values on output (default is ignore)", NULL,
+ ARGTYPE_BOOL },
+ {"mpsuseprox", &mpsuseprox,
+ "Use proximity values on output (default is ignore)",
+ NULL, ARGTYPE_BOOL },
+ {0, 0, 0, 0, 0}
};
/*
mps_wr_deinit,
mps_read,
mps_write,
+ NULL,
mps_args
};
FILE *fd;
FILE *ofd;
-static char *noretired;
+static char *noretired = NULL;
static
arglist_t nav_args[] = {
{"noretired", &noretired, "Suppress retired geocaches.",
- ARGTYPE_BOOL },
- {0, 0, 0, 0}
+ NULL, ARGTYPE_BOOL },
+ {0, 0, 0, 0, 0}
};
#define MYNAME "navicache"
nav_wr_deinit,
nav_read,
nav_write,
+ NULL,
nav_args,
};
#include <ctype.h>
static FILE *file_in;
-static char *nseicon = "Red Square";
-static char *nsneicon = "Green Square";
-static char *seicon = "Red Diamond";
-static char *sneicon = "Green Diamond";
+static char *nseicon = NULL;
+static char *nsneicon = NULL;
+static char *seicon = NULL;
+static char *sneicon = NULL;
static char *snmac = NULL;
-static char *optnseicon = NULL;
-static char *optnsneicon = NULL;
-static char *optseicon = NULL;
-static char *optsneicon = NULL;
static void fix_netstumbler_dupes(void);
static
arglist_t netstumbler_args[] = {
- {"nseicon", &optnseicon, "Non-stealth encrypted icon name", ARGTYPE_STRING },
- {"nsneicon", &optnsneicon, "Non-stealth non-encrypted icon name", ARGTYPE_STRING },
- {"seicon", &optseicon, "Stealth encrypted icon name", ARGTYPE_STRING },
- {"sneicon", &optsneicon, "Stealth non-encrypted icon name", ARGTYPE_STRING },
- {"snmac", &snmac, "Shortname is MAC address", ARGTYPE_BOOL },
- {0, 0, 0, 0}
+ {"nseicon", &nseicon, "Non-stealth encrypted icon name",
+ "Red Square", ARGTYPE_STRING },
+ {"nsneicon", &nsneicon, "Non-stealth non-encrypted icon name",
+ "Green Square", ARGTYPE_STRING },
+ {"seicon", &seicon, "Stealth encrypted icon name",
+ "Red Diamond", ARGTYPE_STRING },
+ {"sneicon", &sneicon, "Stealth non-encrypted icon name",
+ "Green Diamond", ARGTYPE_STRING },
+ {"snmac", &snmac, "Shortname is MAC address", NULL, ARGTYPE_BOOL },
+ {0, 0, 0, 0, 0}
};
static void
rd_init(const char *fname)
{
- nseicon = optnseicon?optnseicon:"Red Square";
- nsneicon = optnsneicon?optnsneicon:"Green Square";
- seicon = optseicon?optseicon:"Red Diamond";
- sneicon = optsneicon?optsneicon:"Green Diamond";
file_in = xfopen(fname, "r", MYNAME);
}
NULL,
data_read,
NULL,
+ NULL,
netstumbler_args
};
static int route_out_count;
static int route_wpt_count;
-static char *snlenopt;
-static char *snwhiteopt;
-static char *snupperopt;
-static char *snuniqueopt;
+static char *snlenopt = NULL;
+static char *snwhiteopt = NULL;
+static char *snupperopt = NULL;
+static char *snuniqueopt = NULL;
static
arglist_t ozi_args[] = {
{"snlen", &snlenopt, "Max synthesized shortname length",
- ARGTYPE_INT},
+ NULL, ARGTYPE_INT},
{"snwhite", &snwhiteopt, "(0/1) Allow whitespace synth. shortnames",
- ARGTYPE_BOOL},
+ NULL, ARGTYPE_BOOL},
{"snupper", &snupperopt, "(0/1) UPPERCASE synth. shortnames",
- ARGTYPE_BOOL},
+ NULL, ARGTYPE_BOOL},
{"snunique", &snuniqueopt, "(0/1) Make synth. shortnames unique",
- ARGTYPE_BOOL},
- {0, 0, 0, 0}
+ NULL, ARGTYPE_BOOL},
+ {0, 0, 0, 0, 0}
};
gpsdata_type ozi_objective;
wr_deinit,
data_read,
data_write,
+ NULL,
ozi_args
};
static
arglist_t palmdoc_args[] = {
{ "nosep", &suppresssep,
- "Suppress separator lines between waypoints", ARGTYPE_BOOL },
- {"dbname", &dbname, "Database name", ARGTYPE_STRING },
- {"encrypt", &encrypt, "Encrypt hints with ROT13", ARGTYPE_BOOL },
+ "Suppress separator lines between waypoints", NULL,
+ ARGTYPE_BOOL },
+ {"dbname", &dbname, "Database name", NULL, ARGTYPE_STRING },
+ {"encrypt", &encrypt, "Encrypt hints with ROT13", NULL,
+ ARGTYPE_BOOL },
{ "logs", &includelogs,
- "Include groundspeak logs if present", ARGTYPE_BOOL },
+ "Include groundspeak logs if present", NULL, ARGTYPE_BOOL },
{ "bookmarks_short", &bmid, "Include short name in bookmarks",
- ARGTYPE_BOOL },
- {0, 0, 0, 0}
+ NULL, ARGTYPE_BOOL },
+ {0, 0, 0, 0, 0}
};
static struct buffer buf;
wr_deinit,
NULL,
data_write,
+ NULL,
palmdoc_args
};
static FILE *file_in;
static FILE *file_out;
static void *mkshort_handle;
-static char *optdeficon = NULL;
-static char *deficon = "Waypoint";
+static char *deficon = NULL;
#define MYNAME "PCX"
static
arglist_t pcx_args[] = {
- {"deficon", &optdeficon, "Default icon name", ARGTYPE_STRING },
- {0, 0, 0, 0}
+ {"deficon", &deficon, "Default icon name", "Waypoint",
+ ARGTYPE_STRING },
+ {0, 0, 0, 0, 0}
};
static void
rd_init(const char *fname)
{
- if ( optdeficon ) {
- deficon = optdeficon;
- }
- else {
- deficon = "Waypoint";
- }
file_in = xfopen(fname, "r", MYNAME);
}
static void
wr_init(const char *fname)
{
- if ( optdeficon ) {
- deficon = optdeficon;
- }
- else {
- deficon = "Waypoint";
- }
file_out = xfopen(fname, "w", MYNAME);
mkshort_handle = mkshort_new_handle();
}
wr_deinit,
data_read,
data_write,
+ NULL,
pcx_args
};
static
arglist_t polygon_args[] = {
{"file", &polyfileopt, "File containing vertices of polygon",
- ARGTYPE_FILE | ARGTYPE_REQUIRED },
+ NULL, ARGTYPE_FILE | ARGTYPE_REQUIRED },
{"exclude", &exclopt, "Exclude points inside the polygon",
- ARGTYPE_BOOL },
- {0, 0, 0, 0}
+ NULL, ARGTYPE_BOOL },
+ {0, 0, 0, 0, 0}
};
static void polytest ( double lat1, double lon1,
static route_head *cur_rte = NULL;
static double pos_dist;
-static char *distopt;
+static char *distopt = NULL;
static char *purge_duplicates = NULL;
-static char *latopt;
-static char *lonopt;
-static char *exclopt;
-static char *nosort;
+static char *latopt = NULL;
+static char *lonopt = NULL;
+static char *exclopt = NULL;
+static char *nosort = NULL;
waypoint * home_pos;
static
arglist_t position_args[] = {
{"distance", &distopt, "Maximum positional distance",
- ARGTYPE_FLOAT | ARGTYPE_REQUIRED },
- {"all", &purge_duplicates, "Suppress all points close to other points", ARGTYPE_BOOL },
- {0, 0, 0, 0}
+ NULL, ARGTYPE_FLOAT | ARGTYPE_REQUIRED },
+ {"all", &purge_duplicates,
+ "Suppress all points close to other points",
+ NULL, ARGTYPE_BOOL },
+ {0, 0, 0, 0, 0}
};
static
arglist_t radius_args[] = {
{"lat", &latopt, "Latitude for center point (D.DDDDD)",
- ARGTYPE_FLOAT | ARGTYPE_REQUIRED },
+ NULL, ARGTYPE_FLOAT | ARGTYPE_REQUIRED },
{"lon", &lonopt, "Longitude for center point (D.DDDDD)",
- ARGTYPE_FLOAT | ARGTYPE_REQUIRED },
+ NULL, ARGTYPE_FLOAT | ARGTYPE_REQUIRED },
{"distance", &distopt, "Maximum distance from center",
- ARGTYPE_FLOAT | ARGTYPE_REQUIRED },
+ NULL, ARGTYPE_FLOAT | ARGTYPE_REQUIRED },
{"exclude", &exclopt, "Exclude points close to center",
- ARGTYPE_BOOL },
+ NULL, ARGTYPE_BOOL },
{"nosort", &nosort, "Inhibit sort by distance to center.",
- ARGTYPE_BOOL },
- {0, 0, 0, 0}
+ NULL, ARGTYPE_BOOL },
+ {0, 0, 0, 0, 0}
};
static double
static
arglist_t psit_args[] = {
-/* {"snlen", &snlen, "Length of generated shortnames", ARGTYPE_INT }, */
- {0, 0, 0, 0}
+/* {"snlen", &snlen, "Length of generated shortnames",
+ NULL, ARGTYPE_INT }, */
+ {0, 0, 0, 0, 0}
};
/* Taken from PsiTrex 1.13 */
psit_wr_deinit,
psit_read,
psit_write,
+ NULL,
psit_args
};
static
arglist_t quovadis_args[] = {
- {"dbname", &dbname, "Database name", ARGTYPE_STRING},
- {0, 0, 0, 0}
+ {"dbname", &dbname, "Database name", NULL, ARGTYPE_STRING},
+ {0, 0, 0, 0, 0}
};
static struct qv_icon_mapping mapping[] = {
wr_deinit,
data_read,
data_write,
+ NULL,
quovadis_args
};
static
arglist_t reverse_route_args[] = {
- {0, 0, 0, 0}
+ {0, 0, 0, 0, 0}
};
void
static
arglist_t saroute_args[] = {
{"turns_important", &turns_important,
- "Keep turns if simplify filter is used", ARGTYPE_BOOL },
+ "Keep turns if simplify filter is used",
+ NULL, ARGTYPE_BOOL },
{"turns_only", &turns_only, "Only read turns; skip all other points",
- ARGTYPE_BOOL },
+ NULL, ARGTYPE_BOOL },
{0, 0, 0, 0 }
};
NULL,
my_read,
NULL,
+ NULL,
saroute_args
};
static
arglist_t routesimple_args[] = {
{"count", &countopt, "Maximum number of points in route",
- ARGTYPE_INT | ARGTYPE_REQUIRED},
- {0, 0, 0, 0}
+ NULL, ARGTYPE_INT | ARGTYPE_REQUIRED},
+ {0, 0, 0, 0, 0}
};
struct xte_intermed;
static
arglist_t sort_args[] = {
- {"gcid", &opt_sm_gcid, "Sort by numeric geocache ID", ARGTYPE_BOOL },
- {"shortname", &opt_sm_shortname, "Sort by waypoint short name", ARGTYPE_BOOL },
- {"description", &opt_sm_description, "Sort by waypoint description", ARGTYPE_BOOL },
- {0, 0, 0, 0}
+ {"gcid", &opt_sm_gcid, "Sort by numeric geocache ID",
+ NULL, ARGTYPE_BOOL },
+ {"shortname", &opt_sm_shortname, "Sort by waypoint short name",
+ NULL, ARGTYPE_BOOL },
+ {"description", &opt_sm_description, "Sort by waypoint description",
+ NULL, ARGTYPE_BOOL },
+ {0, 0, 0, 0, 0}
};
static int
static
arglist_t stackfilt_args[] = {
- {"push", &opt_push, "Push waypoint list onto stack", ARGTYPE_BOOL},
- {"copy", &opt_copy, "Copy waypoint list when pushing", ARGTYPE_BOOL},
- {"pop", &opt_pop, "Pop waypoint list from stack", ARGTYPE_BOOL},
- {"append", &opt_append, "Append list when popping", ARGTYPE_BOOL},
- {"discard", &opt_discard, "Discard top of stack when popping", ARGTYPE_BOOL},
- {"replace", &opt_replace, "Replace list with top of stack (default)", ARGTYPE_BOOL},
- {"swap", &opt_swap, "Swap waypoint list with <depth> item on stack", ARGTYPE_BOOL},
- {"depth", &opt_depth, "Item to use when swapping", ARGTYPE_INT},
- {0, 0, 0, 0}
+ {"push", &opt_push, "Push waypoint list onto stack", NULL,
+ ARGTYPE_BOOL},
+ {"copy", &opt_copy, "Copy waypoint list when pushing", NULL,
+ ARGTYPE_BOOL},
+ {"pop", &opt_pop, "Pop waypoint list from stack", NULL,
+ ARGTYPE_BOOL},
+ {"append", &opt_append, "Append list when popping", NULL,
+ ARGTYPE_BOOL},
+ {"discard", &opt_discard, "Discard top of stack when popping",
+ NULL, ARGTYPE_BOOL},
+ {"replace", &opt_replace, "Replace list with top of stack (default)",
+ NULL, ARGTYPE_BOOL},
+ {"swap", &opt_swap, "Swap waypoint list with <depth> item on stack",
+ NULL, ARGTYPE_BOOL},
+ {"depth", &opt_depth, "Item to use when swapping", NULL, ARGTYPE_INT},
+ {0, 0, 0, 0, 0}
};
struct stack_elt {
static
arglist_t text_args[] = {
{ "nosep", &suppresssep,
- "Suppress separator lines between waypoints", ARGTYPE_BOOL },
+ "Suppress separator lines between waypoints",
+ NULL, ARGTYPE_BOOL },
{ "encrypt", &encrypt,
- "Encrypt hints using ROT13", ARGTYPE_BOOL },
+ "Encrypt hints using ROT13", NULL, ARGTYPE_BOOL },
{ "logs", &includelogs,
- "Include groundspeak logs if present", ARGTYPE_BOOL },
- {0, 0, 0, 0}
+ "Include groundspeak logs if present", NULL, ARGTYPE_BOOL },
+ {0, 0, 0, 0, 0}
};
wr_deinit,
NULL,
data_write,
+ NULL,
text_args
};
static char *iconismarker = NULL;
static char *snlen = NULL;
-static char *margin = "15%";
-static char *xpixels = "768";
-static char *ypixels = "768";
-static char *oldthresh = "14";
-static char *oldmarker = "redpin";
-static char *newmarker = "greenpin";
-static char *unfoundmarker = "bluepin";
-
-static char *optmargin = NULL;
-static char *optxpixels = NULL;
-static char *optypixels = NULL;
-static char *optoldthresh = NULL;
-static char *optoldmarker = NULL;
-static char *optnewmarker = NULL;
-static char *optunfoundmarker = NULL;
+static char *margin = NULL;
+static char *xpixels = NULL;
+static char *ypixels = NULL;
+static char *oldthresh = NULL;
+static char *oldmarker = NULL;
+static char *newmarker = NULL;
+static char *unfoundmarker = NULL;
int scalev;
int short_length;
static
arglist_t tiger_args[] = {
{"nolabels", &nolabels, "Suppress labels on generated pins.",
- ARGTYPE_BOOL },
+ NULL, ARGTYPE_BOOL },
{"genurl", &genurl, "Generate file with lat/lon for centering map.",
- ARGTYPE_OUTFILE },
- {"margin", &optmargin, "Margin for map. Degrees or percentage.",
- ARGTYPE_FLOAT},
+ NULL, ARGTYPE_OUTFILE },
+ {"margin", &margin, "Margin for map. Degrees or percentage.",
+ "15%", ARGTYPE_FLOAT},
{"snlen", &snlen, "Max shortname length when used with -s.",
- ARGTYPE_INT},
- {"oldthresh", &optoldthresh, "Days after which points are considered old.",
- ARGTYPE_INT},
- {"oldmarker", &optoldmarker, "Marker type for old points.",
- ARGTYPE_STRING},
- {"newmarker", &optnewmarker, "Marker type for new points.",
- ARGTYPE_STRING},
+ NULL, ARGTYPE_INT},
+ {"oldthresh", &oldthresh,
+ "Days after which points are considered old.",
+ "14", ARGTYPE_INT},
+ {"oldmarker", &oldmarker, "Marker type for old points.",
+ "redpin", ARGTYPE_STRING},
+ {"newmarker", &newmarker, "Marker type for new points.",
+ "greenpin", ARGTYPE_STRING},
{"suppresswhite", &suppresswhite,
- "Suppress whitespace in generated shortnames", ARGTYPE_BOOL },
- {"unfoundmarker", &optunfoundmarker, "Marker type for unfound points.",
- ARGTYPE_STRING},
- {"xpixels", &optxpixels, "Width in pixels of map.",
- ARGTYPE_INT},
- {"ypixels", &optypixels, "Height in pixels of map.",
- ARGTYPE_INT},
+ "Suppress whitespace in generated shortnames",
+ NULL, ARGTYPE_BOOL },
+ {"unfoundmarker", &unfoundmarker, "Marker type for unfound points.",
+ "bluepin", ARGTYPE_STRING},
+ {"xpixels", &xpixels, "Width in pixels of map.",
+ "768", ARGTYPE_INT},
+ {"ypixels", &ypixels, "Height in pixels of map.",
+ "768", ARGTYPE_INT},
{"iconismarker", &iconismarker,
- "The icon description is already the marker", ARGTYPE_BOOL },
+ "The icon description is already the marker", NULL,
+ ARGTYPE_BOOL },
#if CLICKMAP
{"clickmap", &clickmap, "Generate Clickable map web page.",
- ARGTYPE_BOOL},
+ NULL, ARGTYPE_BOOL},
#endif
- {0, 0, 0, 0}
+ {0, 0, 0, 0, 0}
};
static void
rd_init(const char *fname)
{
- margin = optmargin?optmargin:"15%";
- xpixels = optxpixels?optxpixels:"768";
- ypixels = optypixels?optypixels:"768";
- oldthresh = optoldthresh?optoldthresh:"14";
- oldmarker = optoldmarker?optoldmarker:"redpin";
- newmarker = optnewmarker?optnewmarker:"greenpin";
- unfoundmarker = optunfoundmarker?optunfoundmarker:"bluepin";
file_in = xfopen(fname, "r", MYNAME);
mkshort_handle = mkshort_new_handle();
}
static void
wr_init(const char *fname)
{
- margin = optmargin?optmargin:"15%";
- xpixels = optxpixels?optxpixels:"768";
- ypixels = optypixels?optypixels:"768";
- oldthresh = optoldthresh?optoldthresh:"14";
- oldmarker = optoldmarker?optoldmarker:"redpin";
- newmarker = optnewmarker?optnewmarker:"greenpin";
- unfoundmarker = optunfoundmarker?optunfoundmarker:"bluepin";
file_out = xfopen(fname, "w", MYNAME);
thresh_days = strtod(oldthresh, NULL);
}
wr_deinit,
data_read,
data_write,
+ NULL,
tiger_args,
};
vecs_t *vec = vec_list;
while ( vec->vec ) {
arglist_t *ap;
+ if ( vec->vec->exit ) {
+ (*vec->vec->exit)();
+ }
if ( vec->vec->args ) {
for ( ap = vec->vec->args; ap->argstring; ap++ ) {
if ( ap->argval && *ap->argval ) {
if (vec->vec->args) {
for (ap = vec->vec->args; ap->argstring; ap++){
+ char *opt = NULL;
if ( *ap->argval ) xfree(*ap->argval);
- *ap->argval = get_option(*opts, ap->argstring);
+
+ opt = get_option(*opts, ap->argstring);
+ if ( opt ) {
+ *ap->argval = opt;
+ }
+ else if ( ap->defaultvalue ) {
+ *ap->argval = xstrdup(
+ ap->defaultvalue );
+ }
+ else {
+ *ap->argval = NULL;
+ }
}
}
} else {
*opts = NULL;
+ if (vec->vec->args) {
+ for (ap = vec->vec->args; ap->argstring; ap++){
+ if ( *ap->argval ) xfree(*ap->argval);
+
+ if ( ap->defaultvalue ) {
+ *ap->argval = xstrdup(
+ ap->defaultvalue );
+ }
+ else {
+ *ap->argval = NULL;
+ }
+ }
+ }
}
xfree(v);
#define MYNAME "XCSV"
#define ISSTOKEN(a,b) (strncmp(a,b, strlen(b)) == 0)
-static char *styleopt;
-static char *snlenopt;
-static char *snwhiteopt;
-static char *snupperopt;
-static char *snuniqueopt;
-char *prefer_shortnames;
-char *xcsv_urlbase;
+static char *styleopt = NULL;
+static char *snlenopt = NULL;
+static char *snwhiteopt = NULL;
+static char *snupperopt = NULL;
+static char *snuniqueopt = NULL;
+char *prefer_shortnames = NULL;
+char *xcsv_urlbase = NULL;
static
arglist_t xcsv_args[] = {
- {"style", &styleopt, "Full path to XCSV style file",
+ {"style", &styleopt, "Full path to XCSV style file", NULL,
ARGTYPE_FILE | ARGTYPE_REQUIRED },
- {"snlen", &snlenopt, "Max synthesized shortname length",
+ {"snlen", &snlenopt, "Max synthesized shortname length", NULL,
ARGTYPE_INT},
{"snwhite", &snwhiteopt, "(0/1) Allow whitespace synth. shortnames",
- ARGTYPE_BOOL},
+ NULL, ARGTYPE_BOOL},
{"snupper", &snupperopt, "(0/1) UPPERCASE synth. shortnames",
- ARGTYPE_BOOL},
+ NULL, ARGTYPE_BOOL},
{"snunique", &snuniqueopt, "(0/1) Make synth. shortnames unique",
- ARGTYPE_BOOL},
+ NULL, ARGTYPE_BOOL},
{"urlbase", &xcsv_urlbase, "Basename prepended to URL on output",
- ARGTYPE_STRING},
+ NULL, ARGTYPE_STRING},
{"prefer_shortnames", &prefer_shortnames,
- "Use shortname instead of description", ARGTYPE_BOOL },
- {0, 0, 0, 0}
+ "Use shortname instead of description",
+ NULL, ARGTYPE_BOOL },
+ {0, 0, 0, 0, 0}
};
/* a table of config file constants mapped to chars */
xcsv_wr_deinit,
xcsv_data_read,
xcsv_data_write,
+ NULL,
xcsv_args
};